//
//  HttpDefine.h
//  TXKit
//
//  Created by YM on 2017/5/16.
//  Copyright © 2017年 Tincent. All rights reserved.
//

#ifndef HttpDefine_h
#define HttpDefine_h

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

/**
 *  Http请求的方式
 */
typedef NS_ENUM(NSUInteger, HttpMethod) {
    HttpGet = 0,
    HttpPost,
    HttpPut,
    HttpDelete,
    HttpHead
};


/**
 *  Error Code
 */

// Success
#define TX_HTTP_ERRCODE_SUC                      0
// User Not Exist
#define TX_HTTP_ERRCODE_USER_NOT_EXIST           2
// Invalid Json
#define TX_HTTP_ERRCODE_INVALID_JSON            -1
// Invalid Response
#define TX_HTTP_ERRCODE_INVALID_RESPONSE        -2
// Http Error
#define TX_HTTP_ERRCODE_HTTP_ERROR              -3
// The response of json no success_response
#define TX_HTTP_ERRCODE_RESPONSE_ERROR          -4
// No data in local cache
#define TX_HTTP_ERRCODE_NO_CACHE                -5
// No data in response
#define TX_HTTP_ERRCODE_NO_DATA                 -6
// No data in response
#define TX_HTTP_ERRCODE_DATA_FORMAT_ERR         -7
// Internet connection offline
#define TX_HTTP_ERRCODE_INTERNET_OFFLINE        -1009
// User non login
#define TX_HTTP_ERRCODE_USER_NON_LOGIN          -666666
//UNTOKEN
#define TX_HTTP_ERRCODE_UNTOKEN                 1001
//UNTOKEN
#define TX_HTTP_ERRCODE_UNLOGIN                 1002
//UNAUTH
#define TX_HTTP_ERRCODE_UNAUTH                  1003

/**
 *  Error Obj
 */

#define TX_HTTP_ERR_OBJ_EMPTY_DATA              [NSError errorWithDomain:NSURLErrorDomain code:TX_HTTP_ERRCODE_NO_DATA userInfo:@{NSLocalizedDescriptionKey: @"未获取到数据"}]

#define TX_HTTP_ERR_OBJ_DATA_FORMAT             [NSError errorWithDomain:NSURLErrorDomain code:TX_HTTP_ERRCODE_DATA_FORMAT_ERR userInfo:@{NSLocalizedDescriptionKey: @"接口data格式错误"}]

/**
 *  Notify
 */

#define kNotifyKeyUserOffline                     @"NotifyKeyUserOffline"


#endif /* HttpDefine_h */
